//
// Created by chizuru on 2025/9/29.
//

#pragma once
#include "DeviceComm.h"
#include "IProtocolCodec.h"
#include "SensorTPDevice.h"
#include "TinyXmlRegisterTPMap.h"

class SensorTPController {
public:
    explicit SensorTPController(SensorTPDevice& s, std::shared_ptr<TinyXmlRegisterTPMap>, RetryPolicy rp = {});
    ~SensorTPController() = default;
protected:
    OperationResult getRegisters(uint16_t dev, const std::vector<std::pair<std::string,std::string>>& regs, std::vector<std::optional<uint32_t>>& out);
    OperationResult setRegisters(uint16_t dev, const std::vector<std::tuple<std::string,std::string,uint32_t>>& regs);
private:
    SensorTPDevice& device;
    std::shared_ptr<TinyXmlRegisterTPMap> regMap;
    RetryPolicy rp;
};
